package com.knowledgegraph.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 知识图谱实体类
 * 
 * @author system
 * @since 2024-01-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("kg_knowledge_graph")
public class KnowledgeGraph implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 图谱ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 图谱名称
     */
    @NotBlank(message = "图谱名称不能为空")
    @Size(max = 100, message = "图谱名称长度不能超过100个字符")
    @TableField("name")
    private String name;

    /**
     * 图谱描述
     */
    @TableField("description")
    private String description;

    /**
     * 图谱分类
     */
    @TableField("category")
    private String category;

    /**
     * 实体数量
     */
    @TableField("entity_count")
    private Integer entityCount;

    /**
     * 关系数量
     */
    @TableField("relation_count")
    private Integer relationCount;

    /**
     * 完成度百分比
     */
    @TableField("progress")
    private Integer progress;

    /**
     * 状态 0-草稿 1-发布 2-归档
     */
    @TableField("status")
    private Integer status;

    /**
     * 是否公开 0-私有 1-公开
     */
    @TableField("is_public")
    private Integer isPublic;

    /**
     * 创建者ID
     */
    @TableField("creator_id")
    private Long creatorId;

    /**
     * 创建者名称
     */
    @TableField("creator_name")
    private String creatorName;

    /**
     * 最后编辑者ID
     */
    @TableField("last_editor_id")
    private Long lastEditorId;

    /**
     * 最后编辑者名称
     */
    @TableField("last_editor_name")
    private String lastEditorName;

    /**
     * 图谱配置JSON
     */
    @TableField("config_json")
    private String configJson;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 逻辑删除
     */
    @TableLogic
    @TableField("deleted")
    private Integer deleted;
}